Hey! In order to answer this question, we need to understand the difference between mass and density. Mass is the property of matter that measures its resistance to its acceleration, while density is the measure of mass per volume.
Mass is independent as it just focuses on how heavy an object is while density isn't. It can be represented by this equation.
Density = Mass/Volume
If the iron block has more mass per volume than the gold. Then you can consider that the iron has a higher density than gold. However, only if both have the same amount of volume. If there is less or more, then it can fluctuate.