It depends. Generally when all four slots are occupied, it places more strain on the memory controller (which is on the CPU).
For Ryzen, if you want to run the fastest RAM possible, it is almost always done using only two DIMMS. The same goes for Intel CPUs, however there are a lot more four DIMM kits available that can run at the fastest speeds with Intel CPUs. Sometimes the timings have to be looser to run at the faster speeds with four DIMMs.
So in short, unless you are going with a "prosumer" build (e.g. Threadripper or Intel X299) boards, most of the time two DIMMS are the better idea. but almost always with a Ryzen build.