Hydromagnetic disk winds in young stellar objects and active galactic nuclei