If you insist on a conversion for experimental/educational purposes:

hdiutil convert -format UDRW -o output.iso source.dmg

Before starting the conversion process, it helps to understand why these formats differ.