Measurement of charm and beauty production at central rapidity versus charged-particle multiplicity in proton-proton collisions at root s=7 TeV