I have Ubuntu 18.04.3. I am used to the dock in the left hand picture. However, sometimes I get the right hand picture instead. The right hand one automatically hides. I'd like to only see the left.
What you're seeing in the second screenshot (right one) is not actually the dock, but the GNOME dash. The dash is a default feature of GNOME Shell, it appears only in Activities (and applications) overview. Ubuntu Dock (package name:
gnome-shell-extension-ubuntu-dock) is a GNOME shell extension that turns the dash into a fully-fledged dock that may appear always.
Presumably you're seeing the second screenshot sometimes when the Ubuntu Dock extension is failing to load properly for some reason.
As a temporary workaround either rebbot your system (or log out and log in again) or simply restart GNOME shell by pressing Alt+F2, then typing
r, and finally hitting Enter.
gnome-shell-extension-dashtodock/bionic,bionic 63-1 all