A way to do that:
Start with a plane (ShiftA then 'mesh' and 'plane'), enter edit mode (Tab), select all vertices A and delete X 'faces only'.
Still in edit mode, select the vertices, and hit W subdivide. Then in the operator panel, choose 2 cuts.
Now add a subsurface modifier. Set it to two subdivisions, for instance, and check 'adjust cage to modifier result' :
Select the four corners, then scale S :
For the extrusion :
Select all, extrude Z EZ, the add a loop cut CtrlR and adjust it to the top.
Select the top vertices again, then scale them down a bit.
If you need to close the shape :
Simply add the needed quads, and eventually add another loop cut to make the vert/horz transition more sharp: