Both drives are fine and will work in your iMac.
BUT: The original HDD sensor cable will need to be replaced as with the original one the fans in the iMac will speed up to their top speed, making alot of noise.
You can choose from:
1: Software to control the fan speeds such as this: http://exirion.net/ssdfanctrl/
2: A solution from OWC such as this thermal adapter kit
3: You could purchase an ODD sensor from an older iMac from ebay (2nd hand or pulled) and insert it in the old slot on the Motherboard.
4: Short out the old cable -- shorting the old cable will make the fans spin at a bearable speed.
SSD: Just out of curiosity where are you installing this? In place of the ODD (Optical Disk Drive) or in the slot directly below it?
Hope this helps!🙂