For a discrete-time linear system, we use data from an open-loop experiment to design directly a linear feedback controller enforcing that a given (polyhedral) set of the state is invariant and given (polyhedral) constraints on the control are satisfied. By building on classical results from model-based set invariance and a fundamental result from Willems et al., the controller designed from data has the following desirable features. The satisfaction of the above properties is guaranteed only from data, it can be assessed by solving a numerically-efficient linear program, and, under a certain rank condition, a data-based solution is feasible if and only if a model-based solution is feasible