It seems you are in Spain, and I don't know the law there, but in the USA, generally speaking, you do not need permission from someone to take their picture if they are in public view. However if they in an area where they have a reasonable expectation of privacy, you are not allowed to invade that privacy by photographing them. So for example you can't use a telephoto lens to peer into someone's bedroom.
I do sometimes take photos of people in public. This is a gallery of more than 500 photos I have taken. In most cases, the people did not know I was taking their photo, but you can see that in some cases they posed for me: