Hi Craig
This can normally be done using the optionVar command.
However the two properties you want to modify also require some runtime changes to be made to ensure the current instance of Maya has the correct preferences set. This should work:
import maya.mel
import maya.cmds
# Set these to 1 or 0 depending on if you want it to be on or off
saveLayouts = 1
restoreLayouts = 1
# Save layout
cmds.optionVar(iv=('useSaveScenePanelConfig', saveLayouts))
cmds.file(uc=saveLayouts)
mel.eval('$gUseSaveScenePanelConfig=' + str(saveLayouts))
# Restore layout
cmds.optionVar(iv=('useScenePanelConfig', restoreLayouts))
cmds.file(uc=restoreLayouts)
mel.eval('$gUseScenePanelConfig=' + str(restoreLayouts))
Hope it helps
Mike