Density does not have a directly significant effect on heating. This is more controlled by specific heat and thermal conductivity.
Specific heat is how much heat can be stored by an object. It is more difficult to raise or lower the temperature of an object with a high specific heat. For example, water has higher specific heat than iron, so for the same amount of heat lost by the water and iron, the water's temperature will only lower a little.
Second is thermal conductivity, which is a measure of how fast heat is transferred to or from the object. Metals are thermally conductive, so heat leaves them very quickly. In contrast, water takes much longer to transmit heat.
These two are the main contributors to why the iron would cool faster than the water.