It is all glued together, it will need to be cut of at a given spot and glue a wall adapter on the remainder of the cut off piece.
Picture courtesy Home Depot
If the white pipe (PVC) is at least 1" beyond the face of the wall, and glue is not smeared over it to any major degree, the pipe can be cut just behind the black (ABS) connector. Clean up the square cut you give it, get rid of any burrs, add PVC primer and glue to the wall adapter and pipe, and join together, holding it in place for a short while , until the glue grabs.
If there is not enough room to get the 1" needed to glue on the wall adapter with the original escutcheon on, when you cut the pipe and remove the escutcheon, this should get you another 3/8" of pipe exposed. Then use a "bell escutcheon" to cover the wall adapter once you connect the sink p-trap.
Picture courtesy Signature Hardware
This means the ABS p trap is useless and a new p trap will need to be installed.
Wall adapters come in different sizes, make sure you get the right size, as well as the p trap.