You can do this with Tasker if you are rooted. An explanation is here: http://www.pocketables.com/2012/09/using-tasker-and-external-keyboard-helper-to-better-the-bluetooth-keyboard-experience.html .
If you don't want to pay for Tasker, or you are not rooted, I have done something nearly as good with Llama, which is free on the Play Store.
Tell Llama to trigger an action when Bluetooth Device Connected and name your device. Tell it on this event to trigger the Android intent android.settings.INPUT_METHOD_SETTINGS .
Create a matching event for disconnection. You will then be automatically asked to pick the correct keyboard each time you connect or disconnect the BT keyboard.
In my case I used External Keyboard Helper (Play Store) as my alternate keyboard but you can select Google Keyboard instead.
The result is not totally automated but it just means you are prompted for one or two extra taps when you connect or disconnect the keyboard.