How to use data connection on Apple Watch
I noticed that only phone calls work while my iPhone is turned off and
  data/messages do not work at all. 


This is expected behavior.  In order to use messaging features not only must your iPhone be be on, but it must be signed into iMessage (meaning connected to Wifi and/or cellular.  The phone doesn't not need to be with you, however.


  Only way to use data on my watch is while my iPhone is turned on.


Not exactly.  If an App requires data, it can use it even if your phone is not connected - the limitation is only for messaging apps (SMS, MMS, iMesage, etc.)


  Can somebody explain me how this works and which preconditions need to
  be fulfilled for me to use data connections on my watch?


To use data on your Apple Watch (Series 3 and 4), you just need to be connected to either a cellular network or a WiFi network.  

Apple has an excellent support document How to use your Apple Watch without your iPhone nearby that goes into detail about what's required to use your Apple Watch with cellular.