Lift up the ribbon cable and carefully peel away the black tape underneath. It secures the SATA cable connector to the PCB of the hard drive. Failing to remove the tape will almost surely cause the contacts soldered to the flex cable to rip from the connector housing, as the retention force of the contacts in the housing is quite low.
Pull the SATA cable connector straight out of the hard drive.
Carefully peel off the two black, square-shaped sticky pads (one visible in picture) from the corners of the hard drive, and stick them to your new hard drive in the same locations.