>>1697901yes.
Just make sure that the axis of your dynamo radially aligned to the hub of the wheel like pic related and both lights are working and properly oriented according to code.
Remember in the darkness even a cemetery candle is visible for several hundred meters!
You should also have a red reflector and yellow reflectors on the pedals.
Also you might consider upgrade the rear light with a led-based one (like from Busch+Müller or AXA) which can keep emitting lights for some minutes after the dynamo stopped for example when stopped for traffic; there are also more powerful front dynamo lights if you found riding on roads without street lights.