Docking Attribute Table using PyQgis

There is the setting Open attribute table in a dock window which automatically opens the attribute table in the bottom dock window. You can set this manually via the menubar:

Settings > Options > Data Sources > Open attribute table in a dock window

Or via PyQGIS:

from PyQt4.QtCore import QSettings
QSettings().setValue("/Qgis/dockAttributeTable", True)

To do this in Qgis 3.x (expanding on the accepted answer by @Joseph), use:

from qgis.PyQt.QtCore import QSettings
QSettings().setValue("/Qgis/dockAttributeTable", True)

# And to check the current value of the setting
QSettings().value("/Qgis/dockAttributeTable")