In the Geometry editor, say DesignModeler, create a new plane, where the Z axis is up and at the level of the change in density and slice the square body into 2 pieces, a top and bottom piece.  Now create another new plane where the Z axis is horizontal and the XY plane is aligned with the other change in density along the X axis. Slice the 2 pieces again to get 4 pieces.  Now highlight those 4 bodies and Form New Part to share topology.

Now in Mechanical, you can add mesh controls.  Use Face Meshing on all 4 pieces, then add Edge Sizing on the two sides of the high density square and Edge sizing on the two sides of the low density square. You should get something very similar to what is shown above.