Slight confusion on the learning process
Well, you make a very good point, this is the most painful part of machine learning, we have to label data to make them usable to train models.By labelling the data, we mean to go through the dataset and say what the output of each input is. It means that to each input we attribute a true output.
The input of the learning function in sk-learn for example are always (almost) model.train(X, Y). with X the inputs and Y the corresponding expected outputs.
Labelling is a tedious and long task that must be hand made most of the time. Some website even pay people to label data (especially for image classification or segmentation), such as amazon mechanical turk.