Stability of superfluid and supersolid phases of dipolar bosons in optical lattices.