Establishing the connection between peanut-shaped bulges and galactic bars