This paper considers the problem of ranking and selection with covariates and aims to identify a decision rule that stipulates the best alternative as a function of the observable covariates. We propose a general data-driven framework to accommodate (i) high-dimensional covariates and (ii) general (nonlinear) dependence between the mean performance of an alternative and the covariates. For both scenarios, we design new selection procedures and provide certain statistical guarantees, by leveraging the data-intensive environment and various statistical learning tools. The performances of our procedures are exhibited through simulation experiments.