Sobolev algebras through heat kernel estimates