For Samsung it is possible in the case when the device is not encrypted.
These are devices running on Exynos processor 7420 ((SM-G920, SM-G925, SM-G928) with Android 6x from the factory.
All newer devices have Userdata encrypted partition and nothing can be done without loss.