First-order methods for stochastic and finite-sum convex optimization with deterministic constraints