It is called "potting" electronics. The electronics are constructed as normal, and then potting compound is poured in. This then sets hard and leaves what you see.
It's extremely feasible to do at home, all you need it some form of container to hold the resin as it sets, and this is normally the enclosure. Do make sure the enclosure can't leak through!
Potting electronics helps with a number of issues. If the electronics are going through shock or vibration it helps keeps the components on the board and functional. It will help somewhat with moisture, although if the water is in the air, it has a tendency to get between the board and the potting compound, and then get held there.
If you have high power components, potting compound will increase the temperature as it doesn't conduct heat away as well as air, as well as losing any airflow. As the compound sets, it does tend to get quite hot, so make sure your components are up to this. Most are, but I have had some sensitive components like sensors break.
There is also outgassing. As you pour the compound in, there is a tendency for bubbles to form, which will become voids in the potting. The best way to remove this is to place the enclosure being potted in a vacuum chamber which forces the bubbles out, but at home I'm sure pouring slowly would suffice.
There are plenty of places that carry potting compound, and examples from Farnell would be: