The reason they're using a space in the first image and a dash in the second has to do with how they assembled their visual hierarchy. In the first example, the designer separated the information types by changing the weight of the typeface, which is (usually) a fairly obvious indicator of a division.
The second example is a bit more complicated as it includes 3 information types (chapter, title, subtitle). There's a division with the difference in color with the "Chapter 1" but this may have caused it to look too detached from the rest of the text flow, so the colon may have been added to help signify that they are part of the same text block. This could also help with accessibility for people with vision issues - it's another way a viewer can identify a content division. Further, the entire block is the same weight, so using spaces and line breaks may not divide the content as clearly.
There's a few grammar rules you can follow, but as Lucian pointed out this is all subjective. Look at the guides he posted and work your way out from there.