Mounting a relay socket to a junction box?
The base you show is ~1" and page 8 here:
http://www.farnell.com/datasheets/722224.pdf
Shows a standard relay at just over 2".

It should fit just fine in a 4" deep screw cover junction box if you mount the base to the bottom of the box. Don't mount it to the cover. 

However, if you plan to use a time delay relay or some other type then check the dimensions before you buy your jbox.

Depending on your application, you might consider a solid state relay such as this:
http://www.amazon.com/AC-AC-80-280VAC-24-380VAC-SSR-40AA-Solid/dp/B00976EJXC/ref=sr_1_1?ie=UTF8&amp;qid=1447848272&amp;sr=8-1&amp;keywords=AC+relay

It is only 1.5" high so could be mounted in a 2 ⅛" deep 4" or 4-11/16 box.
Happy Day!