Learning and Designing Stochastic Processes from Logical Constraints