Smooth Mesh Modeling
In that example I worked only with the cylinder and extended it out and squared it off to look like a cube edge .. But if you want to attach the cylinder to a separate cube and want it to join it properly, you have to match vertices. 

Remove the faces off the top of the cube and then add or remove vertices to the cube along the edge so both the cylinder and the cube have the same number where they meet. Then you fill in the faces, bridging the gap .. I have an example. The cylinder has 32 vertices along the edge and the cube began with 4. I connected the corners to the cylinder using edges, that's 4. THen I added 7 vertices on each side of the cube. That gave the cube 32 as well (7x4 +4). Then I began filling the gap. 

If you look at bolts in the add-on 'bolts' you'll see they are made the same way basically where the screw part meets the head .. the cylinder is extended along the flat to the edge and the hexagonal edge vertices have to match the cylinder (ie top of the screw).

Also I have a quick example of attaching two shapes very roughly similar to your die cast example. I attached them  (this involves some editting where they meet) and THEN I worry about extending the flat area which I started to do. Hope it helps.

Oh ya, I saw the comment about retopo ... that's a good method too .. In essence it's joining various shapes and then laying over it a mesh you construct. You have know about how to lay meshes you build on top of objects which is what retopo is .. anyway .. good luck