Extended Bose-Hubbard model with dipolar and contact interactions