Buoyancy-driven instability of bubbly layers: analogy with thermal convection