Efficient Computation with Sparse and Dense Polynomials